Natural Gas Plants¶

Data Imports¶

In [7]:
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
from folium import plugins
import folium


pd.set_option('display.float_format', lambda x: '%0.4f' % x)
In [8]:
gisfilepath = "/Users/jnapolitano/Projects/gas.jnapolitano.io/source/data/Power_Plants.geojson"

powerplants_df = gpd.read_file(gisfilepath)
#Selecting only Operational Plants
powerplants_df=powerplants_df.loc[powerplants_df['STATUS'] == 'OP'].copy()
na = powerplants_df.COAL_USED.min()
powerplants_df.replace(na, 0 , inplace=True)

#powerplants_df = powerplants_df.to_crs(epsg=3857)

powerplants_df.describe()
Out[8]:
OBJECTID LATITUDE LONGITUDE OPER_CAP SUMMER_CAP WINTER_CAP PLAN_CAP RETIRE_CAP GEN_UNITS PLAN_UNIT RETIR_UNIT COAL_USED NGAS_USED OIL_USED NET_GEN CAP_FACTOR LINES SOURCE_LAT SOURC_LONG
count 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000 8736.0000
mean 5709.4960 39.0405 -95.0667 134.5691 123.2273 127.9356 1.5068 12.3725 2.3368 0.0144 0.2098 75285.8993 1351867.2459 3590.2573 466814.5072 0.0371 0.3489 39.0424 -94.1651
std 3315.5893 5.5191 19.0667 367.0281 339.7523 350.9757 36.1032 100.9833 2.8505 0.1797 0.9739 555638.6353 6289781.4216 57026.9476 1813781.4037 12.5042 0.5880 5.5178 21.7038
min 1.0000 18.9737 -171.7124 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -3465212.0000 -1141.5514 0.0000 18.9742 -171.7124
25% 2666.7500 35.1990 -113.7045 2.7000 2.5000 2.4000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2141.7500 0.0574 0.0000 35.1986 -113.6161
50% 5832.5000 39.4456 -91.6117 9.6000 8.7500 8.8000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 11727.0000 0.2137 0.0000 39.4492 -91.0609
75% 8566.2500 42.4995 -78.6045 74.8000 70.0000 72.0000 0.0000 0.0000 3.0000 0.0000 0.0000 0.0000 0.0000 0.0000 133402.5000 0.4291 1.0000 42.5003 -78.2997
max 11810.0000 71.2921 -67.4016 6809.0000 7079.0000 7079.0000 2200.0000 3623.0000 73.0000 5.0000 28.0000 10040760.0000 138014506.0000 4130642.0000 32377477.0000 4.6214 11.0000 71.2920 36.2439

Identifying the Natural Gas Plants in the Data Set¶

In [9]:
ng_plants = powerplants_df.loc[powerplants_df['PRIM_FUEL'] == 'NG'].copy()
ng_plants.describe()
Out[9]:
OBJECTID LATITUDE LONGITUDE OPER_CAP SUMMER_CAP WINTER_CAP PLAN_CAP RETIRE_CAP GEN_UNITS PLAN_UNIT RETIR_UNIT COAL_USED NGAS_USED OIL_USED NET_GEN CAP_FACTOR LINES SOURCE_LAT SOURC_LONG
count 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000
mean 4936.2170 37.7315 -94.5431 319.7446 280.6535 301.5018 4.7839 40.3544 3.6002 0.0385 0.5128 10590.3533 6760297.4407 5262.5403 872963.8896 0.2994 0.6284 37.7312 -94.1531
std 2697.5301 5.2925 16.3506 441.6423 392.7200 420.3190 55.9207 180.0957 2.8842 0.3268 1.5283 105633.4013 12905005.5690 26743.2790 1797171.2252 0.3305 0.6354 5.2923 17.7336
min 5.0000 25.4754 -156.7775 0.4000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -143592.0000 -2.5218 0.0000 25.4756 -156.7786
25% 2425.0000 33.7640 -105.2172 21.1500 19.4500 20.0000 0.0000 0.0000 2.0000 0.0000 0.0000 0.0000 135816.5000 0.0000 10623.2500 0.0218 0.0000 33.7646 -105.2172
50% 5214.5000 38.3896 -92.1184 110.5000 96.5000 100.0000 0.0000 0.0000 3.0000 0.0000 0.0000 0.0000 1108549.0000 0.0000 86682.5000 0.1595 1.0000 38.3898 -92.0328
75% 7157.5000 41.4484 -81.8614 522.4000 455.4750 488.8500 0.0000 0.0000 4.0000 0.0000 0.0000 0.0000 6594170.0000 28.2500 684015.0038 0.5743 1.0000 41.4483 -81.7812
max 11807.0000 71.2921 -68.7100 4263.0000 3692.0000 4027.0000 1163.0000 3623.0000 32.0000 5.0000 28.0000 1937950.0000 138014506.0000 448583.0000 19840914.5150 1.4580 6.0000 71.2920 33.8650

Modifying Unit Scale for Map Legend¶

In [10]:
ng_plants['NGAS_USED']=ng_plants['NGAS_USED'].apply(lambda x: x/1)
ng_plants.rename(columns = {'NGAS_USED':'NGAS_BTUs'}, inplace = True)
ng_plants.describe()
Out[10]:
OBJECTID LATITUDE LONGITUDE OPER_CAP SUMMER_CAP WINTER_CAP PLAN_CAP RETIRE_CAP GEN_UNITS PLAN_UNIT RETIR_UNIT COAL_USED NGAS_BTUs OIL_USED NET_GEN CAP_FACTOR LINES SOURCE_LAT SOURC_LONG
count 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000 1636.0000
mean 4936.2170 37.7315 -94.5431 319.7446 280.6535 301.5018 4.7839 40.3544 3.6002 0.0385 0.5128 10590.3533 6760297.4407 5262.5403 872963.8896 0.2994 0.6284 37.7312 -94.1531
std 2697.5301 5.2925 16.3506 441.6423 392.7200 420.3190 55.9207 180.0957 2.8842 0.3268 1.5283 105633.4013 12905005.5690 26743.2790 1797171.2252 0.3305 0.6354 5.2923 17.7336
min 5.0000 25.4754 -156.7775 0.4000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -143592.0000 -2.5218 0.0000 25.4756 -156.7786
25% 2425.0000 33.7640 -105.2172 21.1500 19.4500 20.0000 0.0000 0.0000 2.0000 0.0000 0.0000 0.0000 135816.5000 0.0000 10623.2500 0.0218 0.0000 33.7646 -105.2172
50% 5214.5000 38.3896 -92.1184 110.5000 96.5000 100.0000 0.0000 0.0000 3.0000 0.0000 0.0000 0.0000 1108549.0000 0.0000 86682.5000 0.1595 1.0000 38.3898 -92.0328
75% 7157.5000 41.4484 -81.8614 522.4000 455.4750 488.8500 0.0000 0.0000 4.0000 0.0000 0.0000 0.0000 6594170.0000 28.2500 684015.0038 0.5743 1.0000 41.4483 -81.7812
max 11807.0000 71.2921 -68.7100 4263.0000 3692.0000 4027.0000 1163.0000 3623.0000 32.0000 5.0000 28.0000 1937950.0000 138014506.0000 448583.0000 19840914.5150 1.4580 6.0000 71.2920 33.8650

Natural Gas Plants Interactive Map¶

{eval-rst}

.. index::
   single: US Natural Gas Plants Interactive Map
In [11]:
ng_map = ng_plants.explore(column="NGAS_BTUs", # make choropleth based on "BoroName" column
     popup=True, # show all values in popup (on click)
     tiles="CartoDB positron", # use "CartoDB positron" tiles
     cmap="Set1", # use "Set1" matplotlib colormap
     style_kwds=dict(color="black"),
     marker_kwds= dict(radius=6),# use black outline)
     scheme = 'EqualInterval',
     k = 5

)
ng_map
Out[11]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Natural Gas Plant Density Interactive Map¶

{eval-rst}

.. index::
   single: US Natural Gas Plant Density Interactive Map
In [12]:
heat_data = [[point.xy[1][0], point.xy[0][0]] for point in ng_plants.geometry ]

mapTest = folium.Map(location = [30, -90], tiles='Cartodb dark_matter', zoom_start = 4)

test = plugins.HeatMap(data = heat_data, show=True)
test.add_to(mapTest)

mapTest
Out[12]:
Make this Notebook Trusted to load map: File -> Trust Notebook